//
//  SimpleNetworkTest.swift
//  SimpleNetwork
//
//  Created by mohen on 15/3/10.
//  Copyright (c) 2015年 mohen. All rights reserved.
//

import UIKit
import XCTest

class SimpleNetworkTest: XCTestCase {

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testQueryString() {
        let net = SimpleNetwork()
        
        // 断言的提示信息，可以省略，不建议省略
        // 如果时间过的很长，一旦某一个测试不通过，单纯看断言可能不明白，当初为什么测试
        XCTAssertNil(net.queryString(nil),"查询参数应该为空值")
        XCTAssert(net.queryString(["name": "zhangsan"]) == "name=zhangsan")
        
        XCTAssert(net.queryString(["name": "zhangsan", "title": "boss"]) == "title=boss&name=zhangsan")
        
        // 测试百分号转译
        XCTAssert(net.queryString(["name": "zhangsan", "book": "ios 8.0"]) == "book=ios%208.0&name=zhangsan")
        
        
    }
}
